<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('resource'); ?>
	<script type="text/javascript" src="<?php echo JS_DIR; ?>jquery.lightbox-0.5.js"></script>
	<link rel="stylesheet" type="text/css" href="<?php echo CSS_DIR; ?>jquery.lightbox-0.5.css" />
<?php $this->_endblock(); ?>
<?php $this->_block('title'); ?>
	Offers
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>
<div id="content" class="box">
	<h1>Offers</h1>
	<div id="menu" class="box">
		<ul class="box">
			<li><a href="<?php echo url('offer/insert');?>"><span>Add</span></a></li>
		</ul>
	</div>
	<div id="search" >
		<form method="get" action="<?php echo url('offer/index'); ?>">
		<input type="text" name="name" value="<?php echo isset($name) ? $name : ''; ?>"/><input type="submit" value="Search" />
		<div id="filter" class="filter">
			
				<label>Availability</label>
				<select name="availability">
					<option value=''>--All--</option>
					<option value="0" <?php echo ('0' == $availability) ? 'selected="selected"' : ''; ?>>Public</option>
					<option value="1" <?php echo ('1' == $availability) ? 'selected="selected"' : ''; ?>>Private</option>
				</select>
				<label>Status</label>
				<select name="status">
					<option value=''>--All--</option>
					<option value="0" <?php echo ('0' == $status) ? 'selected="selected"' : ''; ?>>Pending</option>
					<option value="1" <?php echo ('1' == $status) ? 'selected="selected"' : ''; ?>>Active</option>
					<option value="2" <?php echo ('2' == $status) ? 'selected="selected"' : ''; ?>>Pause</option>
					<option value="3" <?php echo ('3' == $status) ? 'selected="selected"' : ''; ?>>Delete</option>
				</select>
				<label>Type</label>
				<select name="type">
					<option value=''>--All--</option>
					<option value="CPM" <?php echo ('CPM' == $type) ? 'selected="selected"' : ''; ?>>CPM</option>
					<option value="CPC" <?php echo ('CPC' == $type) ? 'selected="selected"' : ''; ?>>CPC</option>
					<option value="CPA" <?php echo ('CPA' == $type) ? 'selected="selected"' : ''; ?>>CPA</option>
				</select>
		</div>
		</form>
	</div>
		<?php if (isset($infos)) 
				{
					foreach ($infos as $info)
					{
		?>
				<p class="msg info"><?php echo $info;?></p>
		<?php		}
				}
		?>

	<table class="full-size">
		<tbody>
			<tr>
				<th>Name</th>
				<th>Availability</th>
				<th>Type</th>
				<th>Price</th>
				<th>Status</th>
				<th>Creatives</th>
				<th>Landing URL</th>
				<th>Campaign</th>
				<th>Action</th>
			</tr>
			<?php
				if(null != $offers)
					echo OfferTable::render($offers);
			?>
		</tbody>
	</table>
</div>
<script type="text/javascript">
	$(function() {
		
	});
</script>
<?php $this->_endblock(); ?>